package com.cbank.service;

import com.cbank.dao.AboutUsDao;
import com.cbank.domain.AboutUs;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class AboutUsService {

    private Logger logger=Logger.getLogger(AboutUsService.class);

    @Autowired
    private AboutUsDao aboutUsDao;

    public AboutUs getAll(){ return this.aboutUsDao.getAll(); }

    public AboutUs getById(Integer id){
        return this.aboutUsDao.getById(id);
    }

    public AboutUs getByViewId(String viewId){
        return this.aboutUsDao.getByViewId(viewId);
    }

    public void save(AboutUs aboutUs){
        AboutUs us=this.aboutUsDao.getById(aboutUs.getId());
        if (us == null){
            this.aboutUsDao.insert(aboutUs);
        }else {
            this.aboutUsDao.uodateAboutUs(aboutUs);
        }
    }
}

